//
//  MallDataCell.m
//  JiuLe
//
//  Created by SunChao on 16/10/30.
//  Copyright © 2016年 Fine. All rights reserved.
//

#import "MallDataCell.h"
#import "UIImageView+WebCache.h"
@implementation MallDataCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)config:(GoodsModel *)model
{
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"商城首页默认图片"]];
    if ([model.type isEqualToString:@"3"]) {
        float price = [model.discountprice floatValue];
        self.priceLabel.text = [NSString stringWithFormat:@"%.0f积分",price];
    }else
    {
    self.priceLabel.text = [NSString stringWithFormat:@"￥%@",model.price];
    }
    
    self.goodsInfoLabel.text = model.title;
    NSLog(@"model:%@",model.goodsId);
    //已下架
    if ([model.status isEqualToString:@"0"]) {
        self.imgNewGoods.image = [UIImage imageNamed:@"goods_down"];
        //新品
    }else if ([model.status isEqualToString:@"1"]){
        self.imgNewGoods.image = [UIImage imageNamed:@"goods_new"];
        //热卖中
    }else if ([model.status isEqualToString:@"2"]){
        self.imgNewGoods.image = [UIImage imageNamed:@"goods_hot"];
        //缺货中
    }else if ([model.status isEqualToString:@"3"]){
        self.imgNewGoods.image = [UIImage imageNamed:@"goods_Stockout"];
    }
}

@end
